<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>

<textarea id="title" name="title"></textarea>
<div id="div1"><h2>使用 jQuery AJAX 来改变文本</h2></div>
<button>获得外部内容</button>

<script>
    $(document).ready(function () {

        $("button").click(function () {
            var title = $("textarea#title").val();
            console.log(title);
            $("#div1").load("{:url('bbs/add')}", {
                title: title,
            }, function (responseTxt, statusTxt, xhr) {
                if (statusTxt == "success")
                    console.log("外部内容加载成功！" + responseTxt);
                if (statusTxt == "error")
                    console.log("Error: " + xhr.status + ": " + xhr.statusText);
            });
        });
    });
</script>
</body>
</html>